package com.qk.management.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @文件名: CourseMapper
 * @作者: DX
 * @创建日期: 2025/10/8
 * @描述:
 */
@Mapper
public interface CourseMapper extends BaseMapper<Course> {
    List<Course> selectByPage(@Param("name") String name,
                              @Param("subject") Integer subject,
                              @Param("target") Integer target);

    @Select("select * from course")
    List<Course> listAll();

    void add(Course course);

    @Delete("delete from course where id = #{id}")
    void deleteById(Integer id);

    @Select("select * from course where id = #{id}")
    Course getById(Integer id);

    void update(Course course);

    @Select("select * from course where subject = #{subject}")
    List<Course> coursesBySubject(Integer subject);
}
